//
//  FirstView.m
//  MvcTest
//
//  Created by SDMac on 15/5/11.
//  Copyright (c) 2015年 SDMac. All rights reserved.
//

#import "FirstView.h"
#import "MyButton.h"

@implementation FirstView
-(id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        self.lbl = [[UILabel alloc] initWithFrame:CGRectMake(30, 94, frame.size.width - 60, 49)];
        self.lbl.font = [UIFont systemFontOfSize:18];
        self.lbl.backgroundColor = [UIColor redColor];
        self.lbl.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.lbl];
        
        self.btn = [UIButton buttonWithType:UIButtonTypeCustom];
        self.btn.titleLabel.font = [UIFont systemFontOfSize:17];
        self.btn.frame = CGRectMake(40, 240, frame.size.width - 80, 49);
        self.btn.backgroundColor = [UIColor greenColor];
        [self.btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [self.btn setTitle:@"First" forState:UIControlStateNormal];
        [self addSubview:self.btn];
        
        MyButton *btn = [MyButton buttonWithType:UIButtonTypeCustom
                                           frame:CGRectMake(30, 320, frame.size.width - 60, 45)
                                           title:@"昆仑"
                                         handler:^(UIButton *sender){
                                         
                                         
                                             UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示"
                                                                                                message:@"调用了Block"
                                                                                               delegate:nil
                                                                                      cancelButtonTitle:@"确定"
                                                                                      otherButtonTitles:nil];
                                             [alertView show];
                                         }];
        btn.backgroundColor = [UIColor grayColor];
        [self addSubview:btn];
    }
    
    return self;
}

@end
